using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for BaseMasterPage
/// </summary>
public abstract class BaseMasterPage : MasterPage
{
    public new BasePage Page
    {
        get
        {
            if (base.Page is BasePage)
                return base.Page as BasePage;
            else
                throw new ApplicationException(string.Format("Page '{0}' does not inherit from BasePage", base.Page.GetType().ToString()));
        }
    }

    public abstract void ReBindBreadCrumbs();

    public class BreadCrumb
    {
        public BreadCrumb() { }
        public BreadCrumb(string name, string url) { Name = name; Url = url; }
        public string Name { get; set; }
        public string Url { get; set; }
    }

    public class BreadCrumbCollection : System.Collections.Generic.List<BreadCrumb>
    {
        public void Add(string name, string url)
        {
            Add(new BreadCrumb() { Name = name, Url = url });
        }

        public void Add(string name)
        {
            Add(name, null);
        }

        public void AddData()
        {
            Add("Data", null);
        }

        public void AddSettings()
        {
            Add("Settings", null);
        }
    }
}
